package com.study.talk.netty;

import io.netty.channel.ChannelFuture;

public interface Netty {
    void connect();
    void reconnect(long time);

    void sendMessage(Object msg);
    void setOnConnectListener(OnConnectLister listener);
    void setOnSendMessageListener(OnSendMessageListener listener);

    void close();

    void disconnect();

    boolean isConnected();

    boolean isOpen();

    ChannelFuture getChannelFuture();

    interface OnConnectLister{
        void success();
        void failed();
        void error();
    }

    interface OnChannelHandler{
        void onMessageReceived(String msg);
        void onException(Throwable e);
    }

    interface OnSendMessageListener{
        void onSendMessage(Object msg,boolean success);
    }

}
